﻿/*---------------------------------------------------------------------------------
-----------------***DaLianQianYi***-----------------------
-----------------作者：大连仟亿科技------------------------------------------------------
-----------------联系作者：www.qianyikeji.com----------------------------------
-----------------时间：2018/5/2 19:31:32------------------------------------------
----------------------------------------------------------------------------------*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Donal.Xms.BLL
{
    /// <summary>
    ///数据业务层
    /// </summary>
    public partial class company
    {
        private readonly Model.sysconfig sysConfig;
        private readonly DAL.company dal;

        public company(bool isRunning = false)
        {
            sysConfig = new BLL.sysconfig().loadConfig();//获得系统配置信息
            dal = new DAL.company(sysConfig.sysdatabaseprefix);
        }

        #region 基本方法================================
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool ExistsCompany(string companyName)
        {
            return dal.ExistsCompany(companyName);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.company model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.company model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="ismaster">1管理员</param>
        public bool Update(Model.company model, bool isAddAudit, int ismaster = 0)
        {
            return dal.Update(model, isAddAudit, ismaster);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {
            return dal.Delete(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.company GetModel(int id)
        {
            return dal.GetModel(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.company GetModel(string erpCode)
        {
            return dal.GetModel(erpCode);
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return dal.GetList(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }

        /// <summary>
        /// 获得查询分页数据
        /// </summary>
        public DataSet GetListView(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
        {
            return dal.GetListView(pageSize, pageIndex, strWhere, filedOrder, out recordCount);
        }

        #endregion

        #region 扩展方法================================

        /// <summary>
        /// 获取溢价名称
        /// </summary>
        /// <param name="isUser">0会员 1组别</param>
        /// <param name="modelId">会员或组别ID</param>
        public string GetPremiumTitle(int isUser, int modelId)
        {
            return dal.GetPremiumTitle(isUser, modelId);
        }

        /// <summary>
        /// 返回指定列
        /// </summary>
        public string GetValue(int id, string fileName)
        {
            return dal.GetValue(id, fileName);
        }

        /// <summary>
        /// 返回指定列
        /// </summary>
        public string GetValue(string erpCode, string fileName)
        {
            return dal.GetValue(erpCode, fileName);
        }

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public bool UpdateField(int id, string strValue)
        {
            return dal.UpdateField(id, strValue);
        }

        /// <summary>
        /// 1购买商品2退货3财务修改4营销活动5推广赠送6账户充值7网上付款8交易退款9信用重置
        /// </summary>
        public bool UpdateFieldFlow(decimal value, string companyCode, string operators, string remark, int flowType, int flowCase)
        {
            return dal.UpdateFieldFlow(value, companyCode, operators, remark, flowType, flowCase);
        }

        /// <summary>
        /// 修改一列数据
        /// </summary>
        public bool UpdateField(string code, string strValue)
        {
            return dal.UpdateField(code, strValue);
        }
        #endregion


    }
}


